//
//  LQYFriendHeaderView.m
//  基本框架
//
//  Created by runone02 on 2018/6/28.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

#import "LQYFriendHeaderView.h"

@implementation LQYFriendHeaderView


- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    self.backgroundColor = [UIColor whiteColor];
    self.bgImgV = [UIImageView new];
    self.bgImgV.contentMode = UIViewContentModeScaleAspectFill;
    self.bgImgV.clipsToBounds = YES;
    self.bgImgV.image = IMAGE(@"568");
    [self addSubview:self.bgImgV];
    
    self.headBgView = [UIView new];
    self.headBgView.backgroundColor = [UIColor whiteColor];
    self.headBgView.layer.borderWidth = 0.5;
    self.headBgView.layer.borderColor = [UIColor lightGrayColor].CGColor;
    [self addSubview:self.headBgView];
    
    
    self.headImgV = [UIImageView new];
    self.headImgV.contentMode = UIViewContentModeScaleAspectFill;
    self.headImgV.clipsToBounds = YES;
    self.headImgV.image = IMAGE(@"bottleRecord");
   [self.headBgView addSubview:self.headImgV];
    
    self.label = [UILabel new];
    self.label.textColor = [UIColor whiteColor];
    self.label.textAlignment = NSTextAlignmentRight;
    self.label.font = [UIFont systemFontOfSize:19];
    self.label.text = USER_NAME;
    [self addSubview:self.label];
    
   
    [self.bgImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.bottom.mas_equalTo (self);
    }];
   
    [self.headBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self).offset(-20);
        make.right.equalTo(self).offset(-10);
        make.width.height.equalTo(@75);
    }];
   
    [self.headImgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.headBgView).offset(3);
        make.right.bottom.equalTo(self.headBgView).offset(-3);
    }];
    
    [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.headBgView.mas_left).offset(-20);
        make.left.equalTo(self).offset(10);
        make.bottom.equalTo(self.bgImgV).offset(-7);
        make.height.equalTo(@25);
    }];
}

@end
